﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Jewelnoid
{
    class FloatingScore : Text2D
    {
        public FloatingScore(SpriteFont spriteFont, String text, Vector2 position)
            : base(spriteFont, text, position, Color.White)
        {
            if (this.position.X + spriteFont.MeasureString(text).X > Game1.self.graphics.PreferredBackBufferWidth)
            {
                this.position.X = Game1.self.graphics.PreferredBackBufferWidth - spriteFont.MeasureString(text).X;
            }
        }

        public void update()
        {
            this.alpha -= 0.01f;
        }

        static public String getFloatingText(int points, int bonus)
        {
            String scoreText = points.ToString();

            if (bonus != 1)
            {
                scoreText = String.Concat(scoreText, " x", bonus);
            }

            return scoreText;
        }
    }
}
